#include <stdio.h>
#include <stdlib.h>

void writeData(FILE *dataFp, char c);
char getRandomCharacter();

int main(int argc, char* argv[]) {
	FILE *dataFp;
	long fileSizeToCreate = 0, i;
	char charToWrite;
	char *fileName;

	if (argc != 3) {
		printf("Usage %s {%s} {%s} \n", argv[0], "FileSizeToCreate", "FilePath");
		exit(-1);
	}
	fileSizeToCreate = atol(argv[1]);
	fileName = argv[2];

	srand(time(NULL ));
	/* open the file */

	dataFp = fopen(fileName, "w");
	if (dataFp == NULL ) {
		perror("I couldn't open data.dat for writing.\n");
		exit(0);
	}

	/* write to the file */

	for (i = 0; i < fileSizeToCreate; i++) {
		writeData(dataFp, getRandomCharacter());
	}

	/* close the file */
	fclose(dataFp);

	return 0;
}

void writeData(FILE *dataFp, char c) {
	fputc(c, dataFp);
}

char getRandomCharacter() {
	return (rand() % 26) + 'A';
}
